package com.yet.kotlinapp.base

import android.os.Bundle
import android.view.View
import com.qmuiteam.qmui.arch.QMUIFragmentActivity
import com.qmuiteam.qmui.widget.QMUITopBarLayout
import com.yet.kotlinapp.modules.login.LoginPresenterImp

/**
 *
 * @ProjectName: Kotlin app
 * @Package: com.yet.kotlinapp.base
 * @ClassName: BaseActivity
 * @Description: java类作用描述
 * @Author: liys
 * @CreateDate: 2021/8/30 14:09
 * @UpdateUser: 更新者
 * @UpdateDate: 2021/8/30 14:09
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
abstract class BaseActivity<P> : QMUIFragmentActivity(),IBView  where P : IBPersente{

     lateinit var present: P

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        present=oncreate()
        setContentView(onlayoutId())
        initView()
    }

    abstract fun onlayoutId():View
    abstract fun oncreate():P
    abstract fun initView()

    fun initToolbar(isshow:Boolean,title:String,isback:Boolean,bar: QMUITopBarLayout){
        if(!isshow){
            bar.visibility= View.GONE
            return
        }else{
            bar.setTitle("注册")
            if(isback){
                bar.addLeftBackImageButton().setOnClickListener {
                    popBackStack()
                }
            }
        }
    }
}